package com.cskaoyan.controller;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author stone
 * @date 2022/03/25 10:44
 */
@RestController
public class ArticleController {

    //通过@PathVariable注解的value属性拿到@RequestMapping注解的value属性中对应名称的占位符的值
    //https://blog.csdn.net/csdnsevenn/article/details/123717270?spm=1000.2115.3001.5927
    @RequestMapping("{name}/article/details/{id}")
    public String articleDetails(@PathVariable("name") String username,
                                 @PathVariable("id") String articleId) {
        System.out.println(username + ":" + articleId);
        return "success";
    }

    public ArticleController() {
        System.out.println("controller init");
    }
}
